package context;

import entity.User;

/**
 * Created by asus on 2017/6/18.
 */
public class UserContext {
    private static ThreadLocal<UserContext> t1 = new ThreadLocal<>();
    private User user;

    private UserContext(User user) {
        this.user = user;
    }

    public static void setCurrent(User user) {
        t1.set(new UserContext(user));
    }

    public static UserContext getCurrent() {
        System.out.println("UserContext");
        return t1.get();
    }

    public User getUser() {
        return user;
    }
}
